{% extends "master.html" %}

{% block title %}Зохиогчийн мэдээллийг оруулах{% endblock %}

{% block script %}
<script type="text/javascript">
function saveAuthor()
{
	document.forms['save_author'].submit();
}
</script>
{% endblock %}

{% block content %}
	{% if user %}
		<table align="center">
			<tbody>
				<tr>
					<td><center><strong><p>Зохиогчийн мэдээллийг оруулах</p></strong></center></td>
				</tr>
			</tbody>
		</table>
		<form name="save_author" method="POST" enctype="multipart/form-data">
			<table align="center">
				<tbody>
					{% if chosen_author.photo %}
						<tr>
							<td>Өмнөх зураг: </td>
							<td><img src="/photo" /></td>
						</tr>
					{% endif %}
					<tr>
					{% if chosen_author.photo %}
						<td>Зураг солих:</td>
					{% else %}
						<td>Зураг: </td>
					{% endif %}
						<td>
							<input type="file" name="photo" />
						</td>
					</tr>
					<tr>
						<td>Дансны дугаар: </td>
						<td>
							<input type="text" name="account" value="{{ chosen_author.account }}" />
						</td>
					</tr>
					<tr>
						<td>Намтар: </td>
						<td>
							<textarea name="biography">{{ chosen_author.biography }}</textarea>
						</td>
					</tr>
					<tr>
						<td></td>
						<td>
							<input type="button" value="Хадгалах" onclick="saveAuthor()" />
							<input type="button" value="Буцах" onclick="history.go(-1)" />
							<input type="hidden" name="chosen_author" value="{{ chosen_author.key.id }}" />
						</td>
					</tr>
				</tbody>
			</table>
		</form>
	{% endif %}
{% endblock %}

{% block sidebar %}{% include "sidebar.html" %}{% endblock %}